{% extends 'base/base1.html' %}

{% block title %}
    添加产品
{% endblock %}

{% block css %}
<style>
    .form-container {
        max-width: 600px;
        margin: 40px auto;
        background: white;
        padding: 40px;
        border-radius: 12px;
        box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    }
    
    .form-title {
        text-align: center;
        color: #2c3e50;
        margin-bottom: 30px;
        font-weight: 700;
        font-size: 2rem;
    }
    
    .form-group {
        margin-bottom: 25px;
    }
    
    .form-group label {
        display: block;
        margin-bottom: 8px;
        color: #555;
        font-weight: 600;
        font-size: 14px;
    }
    
    .form-group input, .form-group select {
        width: 100%;
        padding: 12px 15px;
        border: 2px solid #e9ecef;
        border-radius: 8px;
        font-size: 14px;
        transition: border-color 0.3s ease;
        box-sizing: border-box;
    }
    
    .form-group input:focus, .form-group select:focus {
        outline: none;
        border-color: #3498db;
        box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
    }
    
    .btn-submit {
        width: 100%;
        padding: 15px;
        background: #3498db;
        color: white;
        border: none;
        border-radius: 8px;
        font-size: 16px;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.3s ease;
        margin-top: 20px;
    }
    
    .btn-submit:hover {
        background: #2980b9;
        transform: translateY(-2px);
        box-shadow: 0 5px 15px rgba(52, 152, 219, 0.3);
    }
    
    .btn-back {
        display: inline-block;
        margin-bottom: 20px;
        padding: 10px 20px;
        background: #95a5a6;
        color: white;
        text-decoration: none;
        border-radius: 6px;
        transition: background 0.3s ease;
    }
    
    .btn-back:hover {
        background: #7f8c8d;
        text-decoration: none;
        color: white;
    }
</style>
{% endblock %}

{% block main %}
<div class="form-container">
    <a href="/main/home/" class="btn-back">← 返回产品列表</a>
    
    <h1 class="form-title">添加新产品</h1>
    
    <form method="post" action="" enctype="multipart/form-data">
        {% csrf_token %}
        
        <div class="form-group">
            {{ form.name.label_tag }}
            {{ form.name }}
        </div>

        <div class="form-group">
            {{ form.img.label_tag }}
            {{ form.img }}
        </div>

        <div class="form-group">
            {{ form.price.label_tag }}
            {{ form.price }}
        </div>

        <div class="form-group">
            {{ form.cost_price.label_tag }}
            {{ form.cost_price }}
        </div>

        <div class="form-group">
            {{ form.stock.label_tag }}
            {{ form.stock }}
        </div>

        <div class="form-group">
            {{ form.category.label_tag }}
            {{ form.category }}
        </div>

        <button type="submit" class="btn-submit">添加产品</button>
    </form>
</div>
{% endblock %}